package fr.imag.m2pgi.m2m.geoloc;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import fr.imag.m2pgi.m2m.geoloc.scip.SCIP20;

public class Activator implements BundleActivator {
  
  private ServiceRegistration<Lidar> service;

  public void start(BundleContext context) throws Exception {
    System.out.println("Starting Lidar bundle...");
    //TODO: get property
    int port = 1701;
    service = context.registerService(Lidar.class, new LidarSCIP20(new SCIP20(port)), null);
//    service = context.registerService(Lidar.class, new LidarDummy(), null);
    System.out.println("Lidar service registered.");
  }

  public void stop(BundleContext context) throws Exception {
    System.out.println("Stopping Lidar Bundle...");
    service.unregister();
  }

}
